/*
 * Your license here
 *
 * If you don't need it, remove this file and edit MyMetricUI accordingly.
 */
package sk.smitala.gephi.communitydetection.scan.heuristics;

import java.awt.Dimension;

/**
 *
 * See http://wiki.gephi.org/index.php/HowTo_write_a_metric#Create_StatisticsUI
 *
 * @author Your Name <your.name@your.company.com>
 */
public class ScanHeuristicsPanel extends javax.swing.JPanel {

    private static final int K_DEFAULT = 2;

    /**
     * Creates new form ScanHeuristicsPanel
     */
    public ScanHeuristicsPanel() {
	initComponents();
    }

    @Override
    public Dimension getPreferredSize() {
	return new Dimension(477, 368);
    }
    
    

    /**
     * Add here setters and getters for all properties users can edit.
     */
    public void setK(int k) {
	this.k.setText(k + "");
    }

    public int getK() {
	try {
	    return Integer.parseInt(this.k.getText());
	} catch (NumberFormatException e) {
	    e.printStackTrace(System.err);
	    return K_DEFAULT;
	}
    }

    /**
     * -----------------------------------------------------------
     */
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        directedButtonGroup = new javax.swing.ButtonGroup();
        header = new org.jdesktop.swingx.JXHeader();
        kLabel = new javax.swing.JLabel();
        k = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        kDescription = new javax.swing.JLabel();

        setPreferredSize(new java.awt.Dimension(456, 218));

        header.setDescription(org.openide.util.NbBundle.getMessage(ScanHeuristicsPanel.class, "ScanHeuristicsPanel.header.description")); // NOI18N
        header.setTitle(org.openide.util.NbBundle.getMessage(ScanHeuristicsPanel.class, "ScanHeuristicsPanel.header.title")); // NOI18N

        kLabel.setText(org.openide.util.NbBundle.getMessage(ScanHeuristicsPanel.class, "ScanHeuristicsPanel.kLabel.text")); // NOI18N

        k.setText(org.openide.util.NbBundle.getMessage(ScanHeuristicsPanel.class, "ScanHeuristicsPanel.k.text")); // NOI18N

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sk/smitala/gephi/communitydetection/scan/heuristics/Figure1.PNG"))); // NOI18N
        jLabel1.setText(org.openide.util.NbBundle.getMessage(ScanHeuristicsPanel.class, "ScanHeuristicsPanel.jLabel1.text")); // NOI18N

        kDescription.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        kDescription.setForeground(new java.awt.Color(102, 102, 102));
        kDescription.setText(org.openide.util.NbBundle.getMessage(ScanHeuristicsPanel.class, "ScanHeuristicsPanel.kDescription.text_1")); // NOI18N
        kDescription.setToolTipText(org.openide.util.NbBundle.getMessage(ScanHeuristicsPanel.class, "ScanHeuristicsPanel.kDescription.toolTipText")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(kDescription)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(kLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(k, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(62, 62, 62)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(101, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(kLabel)
                    .addComponent(k, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(kDescription)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(36, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup directedButtonGroup;
    private org.jdesktop.swingx.JXHeader header;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTextField k;
    private javax.swing.JLabel kDescription;
    private javax.swing.JLabel kLabel;
    // End of variables declaration//GEN-END:variables
}
